//
//  SEPatientFileExaminationCell.swift
//  SmartEyeForPatient
//
//  Created by qdsg on 2021/4/17.
//

import UIKit

class SEPatientFileExamineCell: UITableViewCell {

    static let className = "SEPatientFileExamineCell"
    static let reuseId = className



    @IBOutlet weak var collectionView: SETagsCollectionView! 

    @IBOutlet weak var logoView: UIView! {
        didSet {
            logoView.setLayerCorners(rect: logoView.bounds, radius: 4, corners: [.topRight, .bottomRight])
        }
    }

    @IBOutlet weak var collectionViewHeightConstraint: NSLayoutConstraint!

    @IBOutlet weak var bgView: UIView! {
        didSet {
            bgView.layer.cornerRadius = 14
            bgView.layer.shadowColor = UIColor.init(hex: "#8A8A8A").withAlphaComponent(0.15).cgColor
            bgView.layer.shadowOpacity = 1.0
            bgView.layer.shadowRadius = 10.0
            bgView.layer.shadowOffset = CGSize(width: 0, height: 0)
        }
    }


    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var hospitalNameLabel: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    func update(with model: SEPatientFileHealthModel) {

        timeLabel.text = Date.dateStringFormatToString(model.checkData.jiancharq,
                                                       inputFormat: "yyyy-MM-dd HH:mm",
                                                       outputFormat: "yyyy-MM-dd")
        hospitalNameLabel.text = model.checkData.hosName
        collectionView.titles = model.checkData.jiancexmmc

        frame = UIScreen.main.bounds
        layoutIfNeeded()
        collectionView.reloadData()
        let contentSize = collectionView.collectionViewLayout.collectionViewContentSize
        collectionViewHeightConstraint.constant = contentSize.height
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
